#include <iostream>
#include<vector>
using namespace std;
vector<int>arr;
int m,n;
void dfs(int pos)
{

	if(arr.size() == m)
	{
		for(auto x : arr) cout << x << " ";
		cout << endl;
		return;
	}

	for (int i = pos; i <= n; i++)
	{
		arr.push_back(i);
		dfs(i + 1);
		arr.pop_back();
	}

}

int main()
{
	cin >> n>>m;
	dfs(1);

	return 0;
}
